function simpleForof(iterable) {
    let iterator = iterable[Symbol.iterator]()
    while (true) {
        const result = iterator.next()
        if (result.done) break
        console.log(result.value)
    }
}

simpleForof([1, 2, 3, 4, 5])